﻿using System.Web.Optimization;

namespace Qask.Web
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            RegisterJsBundles(bundles);
            RegisterCssBundles(bundles);
            BundleTable.EnableOptimizations = false;
        }

        private static void RegisterJsBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/baseJavascriptBundle").Include(
                "~/Scripts/jquery/jquery-1.11.1.js",
                "~/Scripts/angular/angular.js",
                "~/Scripts/angular/bootstrap/ui-bootstrap-tpls-0.11.0.js",
                "~/Scripts/bootstrap/bootstrap.js"
                ));

            bundles.Add(new ScriptBundle("~/bundles/angularPlugins").Include(
                "~/Scripts/angular/block-ui/angular-block-ui.js",
                "~/Scripts/angular/ng-table/ng-table.js"));

            bundles.Add(new ScriptBundle("~/bundles/jQueryPlugins").Include(
                "~/Scripts/jquery/timeago/jquery.timeago.js",
                "~/Scripts/markdown/Markdown.Converter.js",
                "~/Scripts/markdown/Markdown.Sanitizer.js",
                "~/Scripts/markdown/Markdown.Editor.js"
                ));

            bundles.Add(new ScriptBundle("~/bundles/RegisterAccountJsBundle").Include(
                "~/Scripts/app/directives/angular-pagedown.js",
                "~/Scripts/app/controllers/RegisterAccountController.js"));

            bundles.Add(new ScriptBundle("~/bundles/ChangeTimeZoneJsBundle").Include(
                "~/Scripts/app/directives/angular-pagedown.js",
                "~/Scripts/app/services/TimeZoneService.js",
                "~/Scripts/app/controllers/ChangeTimeZoneController.js"
                ));
            
            bundles.Add(new ScriptBundle("~/bundles/ListQuestionJsBundle").Include(
                "~/Scripts/app/filters/json-date-filters.js",
                "~/Scripts/app/directives/angular-pagedown.js",
                "~/Scripts/app/services/QuestionService.js",
                "~/Scripts/app/controllers/ListQuestionController.js"
                ));

            bundles.Add(new ScriptBundle("~/bundles/SingleQuestionJsBundle").Include(
                "~/Scripts/app/directives/votes-directive.js",
                "~/Scripts/app/directives/post-directive.js",
                "~/Scripts/app/directives/angular-pagedown.js",
                "~/Scripts/app/services/QuestionService.js",
                "~/Scripts/app/controllers/QuestionController.js"
                ));

            // Added reference to select2.js
            bundles.Add(new ScriptBundle("~/bundles/Select2").Include(
                "~/Scripts/select2/select2.js"
                ));
        }

        private static void RegisterCssBundles(BundleCollection bundles)
        {
            bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/bootstrap-3.2.0-dist/css/bootstrap.css",
                "~/Content/block-ui/angular-block-ui.css",
                "~/Content/markdown/markdown.css",
                "~/Content/site.css",
				"~/Content/css/select2.css"
                ));
        }

    }
}
